def explain_json(item):
    result = []
    operation = f" {item['operation']} "

    def explain_condition(conditions):
        field_name = conditions['field_name']
        operation = conditions['operation']
        values = conditions['values']
        if type(values) == list:
            values = tuple(values)
        res = "( %s %s %r )" % (field_name, operation, values)
        return res

    for condition in item['condition']:
        if 'field_name' in condition:
            result.append(explain_condition(condition))
        else:
            operation = f" {item['operation']} "
            result.append(explain_json(condition))
    return f"({operation.join(result)})"
